@import './variables';
//reset

*{
  box-sizing: border-box;
  outline: none;
}

html{
  padding: 0;
  font-size: 13px;
}

body{
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.2rem;
  background: #f1f1f1;
  -webkit-font-smoothing:antialiased;
}

a{
  color: #999;
}
p{
  line-height: 1.5em;
}

@each $colorKey,$color in $colors {
  .text-#{$colorKey}{
    color:$color;
  }
  .bg-#{$colorKey} {
    background:$color;
  }
}
//text-align
@each $var in (left,center,right) {
  .text-#{$var}{
    text-align: $var !important;
  }
}
@each $sizeKey,$size in $font-sizes {
  .fs-#{$sizeKey}{
    font-size: $size*$base-font-size;
  }
}
//text
.text-ellipsis {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
//width height
.w-100{
  width: 100%;
}
.h-100{
  height: 100%;
}
//flex布局
.d-flex{
  display: flex;
}
.flex-column{
  flex-direction: column;
}
.flex-wrap {
  flex-wrap: wrap;
}
.flex-nowrap{
  flex-wrap: nowrap;
}
@each $jcKey,$val in $flex-jc {
  .jc-#{$jcKey}{
    justify-content: $val;
  }
}



@each $key,$val in $flex-ai {
  .ai-#{$key} {
    align-items: $val;
  }
}

.flex-1{
  flex: 1;
}
.flex-grow-1{
  flex-grow: 1;
}


@each $typeKey,$type in $spacing-types {
  //.m-1{margin:1rem}
  @each $sizeKey,$size in $spacing-sizes {
    .#{$typeKey}-#{$sizeKey} {
      #{$type}:$size*$spacing-base-size;
    }
  }
  //.mx-1{margin:0 1rem}
  @each $sizeKey,$size in $spacing-sizes {
    .#{$typeKey}x-#{$sizeKey} {
      //#{$type}:0 $size*$spacing-base-size;
      #{$type}-left:$size*$spacing-base-size;
      #{$type}-right:$size*$spacing-base-size;
    }
  }
  //.my-1{margin:1rem 0}
  @each $sizeKey,$size in $spacing-sizes {
    .#{$typeKey}y-#{$sizeKey} {
      //#{$type}:$size*$spacing-base-size 0;
      #{$type}-top:$size*$spacing-base-size;
      #{$type}-bottom:$size*$spacing-base-size;
    }
  }
  @each $directionKey,$direction in $spacing-directions {
    @each $sizeKey,$size in $spacing-sizes {
      //.mt-1{margin-top:1rem}
      .#{$typeKey}#{$directionKey}-#{$sizeKey} {
        #{$type}-#{$direction}:$size*$spacing-base-size;
      }
    }
  }
}

//button
.btn{
  border: none;
  border-radius: 0.1538rem;
  font-size: map-get($font-sizes, 'sm')*$base-font-size;
  padding: .3rem .6rem;
  &.btn-lg{
    display: flex;
    justify-content: center;
    align-items: center;
    i{
      color: map-get($colors, "primary");
      font-weight: bold;
      font-size: 1.5rem;
      margin-right: .5rem;
    }
    background: map-get($colors, 'light');
    border: 1px solid $border-color;
    padding: 0.8rem 1rem;
    font-size: 1rem;
  }
}
//nav
.nav{
  display: flex;
  //justify-content: space-around;
  .nav-item{
    border-bottom: 3px solid transparent;
    padding-bottom: .1rem;
    &.active{
      color: map-get($colors, 'primary');
      border-bottom: 3px solid map-get($colors, 'primary');
    }
  }
  &.nav-inverse{
    .nav-item{
      color: map-get($colors, 'white');
      &.active{
        border-bottom: 3px solid map-get($colors, 'white');
      }
    }
  }
}

//sprite
.sprite{
  background: url(../index.png) no-repeat 0 0;
  background-size: 28.8462rem;
  display: inline-block;
  &.sprite-people{
    width: 1.7692rem;
    height: 1.5385rem;
    background-position: 63.546% 15.517%;
  }
  &.sprite-book {
    width: 1.7692rem;
    height: 1.5rem;
    background-position: 90.483% 15.614%;
  }
  &.sprite-shop {
    width: 1.4231rem;
    height: 1.6923rem;
    background-position: 36.746% 0.924%;
  }
  &.sprite-music {
    width: 2.3846rem;
    height: 1.8846rem;
    background-position: 9.302% 0.813%;
  }
  &.sprite-shield {
    width: 1.8077rem;
    height: 1.8077rem;
    background-position: 63.3% 0.927%;
  }
  &.sprite-sign {
    height: 1.5769rem;
    background-position: 89.733% 1.266%;
    width: 1.5rem;
  }
  &.sprite-scroll {
    width: 1.8461rem;
    height: 1.5384rem;
    background-position: 36.467% 15.287%;
  }
  &.sprite-fold {
    width: 1.5rem;
    height: 1.5384rem;
    background-position: 10.408% 15.517%;
  }

  &.sprite-gift {
    width: 1.6923rem;
    height: 1.6923rem;
    background-position: 36.827% 27.367%;
  }

  &.sprite-star {
    width: 1.4231rem;
    height: 1.5769rem;
    background-position: 89.621% 27.503%;
  }
  &.sprite-arrow{
    width: 0.7692rem;
    height: 0.7692rem;
    background-position: 38.577% 52.076%;
  }
}

//boreders
@each $dir in (top,right,bottom,left) {
  .border-#{$dir}{
    border-#{$dir}:1px solid $border-color;
  }
}
